package org.karelun.rabbit.rcp.policy;

import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.edit.command.DeleteCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.karelun.ideaboard.gef.editpolicies.ComponentEditPolicy;
import org.karelun.ideaboard.gef.requests.GroupRequest;
import org.karelun.rabbit.graph.Diagram;
import org.karelun.rabbit.graph.Shape;

public class DeleteShapeEditPolicy extends ComponentEditPolicy{
	
	protected Command createDeleteCommand(GroupRequest deleteRequest) {
		Diagram diagram=(Diagram) getHost().getParent().getModel();
		Shape shape=(Shape)getHost().getModel();
		
//		DeleteShapeCommand deleteShapeCommand = new DeleteShapeCommand(diagram,shape);
//		return deleteShapeCommand.createCompoundCommand();
		
		EditingDomain editingDomain = (EditingDomain)getHost().getAdapter(EditingDomain.class);
		return DeleteCommand.create(editingDomain, shape);
	}
}
